The Expected Value of a Random Variable X is the sum of the product of each possible value1 of X times the Probability of seeing that value. In the discrete case (and you'll see all these as ways of notating the same idea),
The Expected Value of a number 42 is... drumroll... 42. This may seem silly to state but there's a Linearity property that's pretty important. If X is a Random Variable and a and b are some constants,
E[a+bX]=E[a]+E[bX]=a+bE[X]
This is a Very Nice Thing to use in proofs and computations. ashifts and bscalesE[X].
E[E[X]]=E[X]. May seem obvious to a lot of people but not to yours truly because I overthink things. E[X]has been computed and is not a Random Variable!
What is the Expected Value of a Dice Roll?
3.5
OK what is the Expected Value of the Expected Value of a Dice Roll?
We just did that. Still 3.5, the Expected Value of a Dice Roll... are you okay?
β‘
Now this one's a doozy: if Y is another Random Variable, E[E[Yβ£X]]=E[Y]. How can that be?
Consider this: What is the Expected Value of height H in 145 people you picked at random and where all heights are equally likely?
Now you ask: What is the Expected Value of the height given a Random Variable Sex, Sβ{Male,Female,Intersex}? This is a simple conditional probability. Remembering the Expected Value is the sum of products of realizations and their probabilities,
E[Hβ£S]=βhβ P(H=hβ£S)
Now E[Hβ£S] is still a random variable because we haven't specified a value for S (i.e., we haven't 'collapsed' it to a specific thing like E[Hβ£S=Female]). So once again, remembering that Expected Value is the sum of products of all values of S and their probabilities,
So you're getting the Expected Value of the height across everyone in S, which is simply E[H] π₯³ This is very nice when we get to Variance and Covariance!
The Variance of a Random Variable X is how much we expect it to deviate from its Expected Value and is a Random Variable itself3. We square it first because we want a nice positive number.